package com.mmlc.meimei.lichengkongjian.been;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/7/20 0020.
 */
public class SendTraceBean implements Parcelable {

    public String sendNumber;
    public String infoSource;
    public List<TraceBean> listTraceBean = new ArrayList<>() ;
    public static class TraceBean implements Parcelable {
        public String desc;
        public String time;

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.desc);
            dest.writeString(this.time);
        }

        public TraceBean() {
        }

        protected TraceBean(Parcel in) {
            this.desc = in.readString();
            this.time = in.readString();
        }

        public static final Creator<TraceBean> CREATOR = new Creator<TraceBean>() {
            @Override
            public TraceBean createFromParcel(Parcel source) {
                return new TraceBean(source);
            }

            @Override
            public TraceBean[] newArray(int size) {
                return new TraceBean[size];
            }
        };
    }

    public void putItem(String desc,String time){
        TraceBean traceBean = new TraceBean();
        traceBean.desc = desc;
        traceBean.time = time;
        listTraceBean.add(traceBean);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.sendNumber);
        dest.writeString(this.infoSource);
        dest.writeList(this.listTraceBean);
    }

    public SendTraceBean() {
    }

    protected SendTraceBean(Parcel in) {
        this.sendNumber = in.readString();
        this.infoSource = in.readString();
        this.listTraceBean = new ArrayList<TraceBean>();
        in.readList(this.listTraceBean, TraceBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<SendTraceBean> CREATOR = new Parcelable.Creator<SendTraceBean>() {
        @Override
        public SendTraceBean createFromParcel(Parcel source) {
            return new SendTraceBean(source);
        }

        @Override
        public SendTraceBean[] newArray(int size) {
            return new SendTraceBean[size];
        }
    };
}
